package com.kaiyidiannao.activity.softVersion;

import android.content.Context;
import android.content.pm.PackageManager;
import android.util.Log;
import com.kaiyidiannao.main.R;

/**
 * Created by wzg on 14-5-10.
 */
public class Config {
    private static final String TAG = "Config";

    public static final String UPDATE_SERVER = "http://www.3tixa.com:8086/kaiyi/api/app/update.php";
    public static final String UPDATE_APKNAME = "jtapp-12-updateapksamples.apk";
    public static final String UPDATE_VERJSON = "ver.json";
    public static final String UPDATE_SAVENAME = "updateapksamples.apk";


    public static float getVerCode(Context context) {
        int verCode = -1;
        try {
            verCode = context.getPackageManager().getPackageInfo(
                    "com.kaiyidiannao.main", 0).versionCode;
        } catch (PackageManager.NameNotFoundException e) {
            Log.e(TAG, e.getMessage());
        }
        return verCode;
    }

    public static String getVerName(Context context) {
        String verName = "";
        try {
            verName = context.getPackageManager().getPackageInfo(
                    "com.kaiyidiannao.main", 0).versionName;
        } catch (PackageManager.NameNotFoundException e) {
            Log.e(TAG, e.getMessage());
        }
        return verName;

    }

    public static String getAppName(Context context) {
        String verName = context.getResources()
                .getText(R.string.app_name).toString();
        return verName;
    }
}